import os

import logzero

DEBUG = False
profile_file = os.path.join(os.path.expanduser('~'), 'profile')
if os.path.exists(profile_file):
    with open(profile_file) as f:
        if f.read().strip() == 'dev':
            DEBUG = True
print(f'DEBUG={DEBUG}')
HEADERS = {
    'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) '
                  'Chrome/61.0.3163.91 Safari/537.36'
}
# chrome_driver所在的位置
CHROME_DRIVER_PATH = '/Usr/local/bin/chromedriver'

# phantomjs所在的位置
PHANTOMJS_PATH = '/usr/local/bin/phantomjs'
# 是否可见
USE_FACE = False
# 截图存放路径
pwd = os.path.dirname(os.path.abspath(__file__))
SCREENSHOT_PATH = os.path.join(pwd, 'screenshot')
# MONGO地址
if DEBUG:
    OSS_ORIGINAL_URL = 'http://qdbuluo.oss-cn-beijing.aliyuncs.com/'
    OSS_IMG_URL = 'http://qdbuluo.qcomic.cc/'
    OSS_BUCKET = 'qdbuluo'
    OSS_ACCESS_KEY_ID = 'LTAI0OrY1GUzZxD2'
    OSS_ACCESS_KEY_SECRET = 'G9lgeS1ogDUl1ex6N2pHsmqlmqNGIX'
    MONGO_HOST = '10.10.6.3'
else:
    OSS_ORIGINAL_URL = 'http://qdbuluo.oss-cn-beijing.aliyuncs.com/'
    OSS_ACCESS_KEY_ID = 'LTAI0OrY1GUzZxD2'
    OSS_ACCESS_KEY_SECRET = 'G9lgeS1ogDUl1ex6N2pHsmqlmqNGIX'
    OSS_IMG_URL = 'http://qdbuluo.qcomic.cc/'

    OSS_BUCKET = 'qdbuluo'
    MONGO_HOST = '10.10.10.4'
MONGO_PORT = 3000
MONGO_DATABASE = 'qingdian'
REPORT_ERROR_COLLECTION_NAME = 'report_error'
COLLECTION_FEED = 'feed'
RUN_BEGIN = 0
RUN_END = 1

if DEBUG:
    REDIS_HOST = '10.10.6.5'
    REDIS_POST=6012
    DB_DATABASE_CENTER = 'qingdian'
    RABBITMQ_HTOS = '10.10.6.5'
    RABBITMQ_POST = 5672
    RABBITMQ_USER = 'yanghao'
    RABBITMQ_PASSWORD = 'yh123-asd'
else:
    REDIS_HOST = '10.10.10.3'
    REDIS_POST=6000
    RABBITMQ_HTOS = '10.10.10.3'
    RABBITMQ_POST = 5000
    RABBITMQ_USER = 'hgz'
    RABBITMQ_PASSWORD = 'hgz123^%$'

# 邮件服务
SMTP_SERVER = 'smtp.exmail.qq.com'
FROM_ADDR = 'jiankong@qingdian.cn'
PASSWORD = 'Qingdian123'
TO_ADDRS = ['chenzhang@qingdian.cn', ]
TO_ADDRS += ['yanghao@qingdian.cn', 'wangjianru@qingdian.cn', 'huangguangzhong@qingdian.cn', 'guoxin@qingdian.cn']
# port = 25

port = 465
templates_dir = 'templates'
template_html = 'email_template.html'
log_dir = 'log'

# 日志
LOG_FORMAT = logzero.LogFormatter(color=True,
                                  fmt='[%(levelname)s] %(asctime)s thread:%(thread)s [%(name)s.%(funcName)s:%(lineno)d]: %(message)s')

if DEBUG:
    BL_MYSQL_CONF = {
        'host': '10.10.6.2',
        'port': 3306,
        'user': 'develop',
        'password': '123-qwe',
        'db': 'qdbuluo',
        'charset': 'utf8mb4',
    }
else:
    BL_MYSQL_CONF = {
        'host': '10.10.10.43',
        'port':2000,
        'user': 'qd',
        'password': '123^%$-qwe-asd',
        'db': 'lt',
        'charset': 'utf8mb4',
    }
# 实时更新最多的到的条数
WEIBO_UPDATE_NUM = 3

BILIBILICOOKIE='finger=6759d89f; LIVE_BUVID=AUTO8215305215188879; sid=a2llmu27; DedeUserID=278341012; DedeUserID__ckMd5=900d3f01ad531e71; SESSDATA=c472106b%2C1533113523%2C9a9b73ef; bili_jct=c59002d60be68bc9362f9bfe209077c3; _dfcaptcha=3b52e0db511420b945a39f6b154e555f; buvid3=295901FB-5F97-42F3-A1ED-7C109491A9C33830infoc; fts=1530521528; UM_distinctid=1645a3128cd2f0-05086f77082e83-1e2e130c-1fa400-1645a3128ceb13'